package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.SaleOrderBean;
import com.project.service.ISaleOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * 销售订单明细controller
 */
@RequestMapping("saleOrderInfo")
@RestController
public class SaleOrderInfoController {

    @Autowired
    private ISaleOrderInfoService saleOrderInfoService;

    //动态条件分页模糊查询销售订单集合
    @RequestMapping("findByItem")
    public IPage<SaleOrderBean> findByItem(Integer pageNO, String clientName
            , LocalDate startDate, LocalDate endDate) {
        return saleOrderInfoService.findByItem(pageNO, clientName, startDate, endDate);
    }

    //按销售订单id，查询销售详情。
    @RequestMapping("findByOrderId")
    public SaleOrderBean findByOrderId(Integer saleOrderId) {
        return saleOrderInfoService.findByOrderId(saleOrderId);
    }
}
